package cate.game.play.skill.active;

import cate.common.util.XT;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;

import java.util.List;

/**
 * 40%对其中一个目标附加【眩晕】
 */
public class 梦断魂殇AH extends ActiveHandler{

	private int 概率;

	private int buff;

	//概率=4000&buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		概率 = args.getInt("概率", 0);
		buff = args.getInt("buff", 0);
	}

	@Override
	public void onSkillDone(SkillActionCtx action) {
		List<Fighter> targets = action.getTargets();
		if (XT.isBlank(targets)) {
			return;
		}
		targets.get(XT.randomIndex(targets.size())).buff.tryAddByTid(action, skill.owner, buff, 概率);
	}
}
